<HTML>
<HEAD>
<TITLE>Running a PHP Session with Prolog</TITLE>
</HEAD>

<BODY>

[ <A HREF="/index.html">Jocelyn Ireson-Paine's Home Page</A>
| <A HREF="/dobbs/prolog_from_php.html"><CITE>How to Call SWI-Prolog from
PHP</CITE></A>
]

<CENTER>
<H1>Running a PHP Session with Prolog</H1>
</CENTER>
<?
session_start(); 

if ( isset( $_SESSION['views'] ) ) {

    $views_so_far = $_SESSION['views'];

    $goal = "test($views_so_far)";

    $cmd = "nice -n15 c:/xampp/swipl/bin/swipl -f C:\Users\angye\Documents\Prolog\patos.p -g \"$goal,halt\"";

    $output = shell_exec( $cmd );

    list($english_state,$prolog_state) = split ("==========", $output, 2);

    echo $english_state;

    $_SESSION['views'] = $prolog_state;
}
else
    $_SESSION['views'] = 1;

?>
</P>

</BODY>
</HTML>